package com.chinaunicom.emergency.security;


import org.apache.commons.lang3.StringUtils;

import java.security.MessageDigest;


/**
 * RSA加密解密工具
 * 
 
 */
public class Md5Util {

	/**
	 * 获取小写md5加密值
	 */
	public static String  md5TlLower(String str){
		if(StringUtils.isNotBlank(str)){
			try{
				MessageDigest md = MessageDigest.getInstance("MD5");
				md.update(str.getBytes());
				byte[] b = md.digest();
				StringBuffer buf = new StringBuffer("");
				for(int offset = 0;offset<b.length;offset++){
					int i = b[offset];
					if(i < 0){
						i += 256;
					}
					if(i < 16){
						buf.append("0");
					}
					buf.append(Integer.toHexString(i));
				}
				str = buf.toString();
			}catch (Exception e){
				e.printStackTrace();
			}
		}else {
			str = "";
		}
		return str;
	}
}
